package edu.cuit.avatar.loop;

import java.util.Scanner;

public class DowhileTest {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        int sum = 0;
        int number = 0;
        //先执行一次循环体,然后再判断循环是否继续
        do{
            System.out.println("请输入一个整数,0退出");
            number = input.nextInt();
            sum += number;
        }while(number != 0);

        System.out.println("sum = " + sum);
    }
}
